package cn.ljy.mes.model;

import cn.ljy.common.model.BaseModel;
import cn.ljy.common.model.validate.AddWorkValidation;
import cn.ljy.common.model.validate.UpdateWorkValidation;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 物料库存详细表
 * @author ljy
 * @date 20250419
 * 备注：
 */
@ApiModel(value="物料库存详情表")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false,of = {"id"})
public class WmsMaterialInventoryDetail extends BaseModel {
    @NotBlank(groups = UpdateWorkValidation.class,message="id不能为空")
    private String id;
    @NotNull(groups = AddWorkValidation.class,message="物料库存不能为空")
    private WmsMaterialInventory materialInventory;//物料库存
    @NotNull(groups = AddWorkValidation.class,message="请选择要存储的物料")
    private WmsMaterialBatch materialBatch;//物料批次
    @NotNull(groups = AddWorkValidation.class,message="请选择要存储物料的库位")
    private WmsWarehouseSeat warehouseSeat;//库位
    @NotNull(groups = AddWorkValidation.class,message="请输入存入库存的物料数量")
    @Range(groups = AddWorkValidation.class,min = 1,message = "存入库存的物料数量必须大于等于{min}")
    private Long inventory;//现有库存
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Long lockQuantity;//锁定数量（由业务决定），出库数量不能大于（库存数量-锁定数量）
    @Length(max = 255, message = "备注长度不能超过{max}")
    private String remark;
    private Boolean isLock;//是否锁定商品库存，锁定后无法进行出入库
    //非数据库字段

    public WmsMaterialInventoryDetail(String id) {
        this.id = id;
    }
}
